package com.ailk.bigdata.etl.realstream.server.model;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 * 
 * @description 接收消息封装实体类
 * @author [xuwei3]
 * @version [版本号,2014-11-7]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class RealStreamDataPack extends BaseNetPackage
{
	private static final long serialVersionUID = -7343498237910199760L;

	private int packLength;// 包长度
	private String reservedField;// 保留字
	private int dataLength;// 数据长度

	public static RealStreamDataPack build(int dataType, byte[] messages)
	{
		RealStreamDataPack pack = new RealStreamDataPack();
		pack.setDataType(dataType);
		pack.setPackLength(messages.length);
		pack.setDataLength(messages.length);
		pack.setDataContent(Unpooled.copiedBuffer(messages));
		messages = null;
		return pack;
	}

	public static RealStreamDataPack build(int dataType, int packLength, String reservedField, int dataLength, ByteBuf dataContent)
	{
		RealStreamDataPack pack = new RealStreamDataPack();
		pack.setDataType(dataType);
		pack.setPackLength(packLength);
		pack.setReservedField(reservedField);
		pack.setDataLength(dataLength);
		pack.setDataContent(dataContent);
		return pack;
	}

	public int getPackLength()
	{
		return packLength;
	}

	public void setPackLength(int packLength)
	{
		this.packLength = packLength;
	}

	public String getReservedField()
	{
		return reservedField;
	}

	public void setReservedField(String reservedField)
	{
		this.reservedField = reservedField;
	}

	public int getDataLength()
	{
		return dataLength;
	}

	public void setDataLength(int dataLength)
	{
		this.dataLength = dataLength;
	}

}
